home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Classes / DE_SerialSolutions2.0 / SerialAndModem2.0 / Serial.h < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.0 KB  |  108 lines

  1.  
  2. //
  3. //"Copyright (C) BenaTong 1992  All rights reserved"
  4. //Version 2.00 
  5. //last mod 8/13/1992
  6.  
  7. #import <objc/Object.h>
  8. #import <sgtty.h>
  9.  
  10. #define ON     1
  11. #define OFF    0
  12.  
  13. #define EVEN     1
  14. #define ODD          2
  15. #define NONE     3
  16. #define SPACE     4
  17. #define MARK     5
  18.  
  19. #define SEC 1000000L
  20. #define SERIALOK 0
  21.  
  22. #define PORTNOTOPEN     -1
  23. #define TIMEOUT         -2
  24. #define BADPARITY     -3
  25. #define BADBAUD     -4
  26. #define BADLENGTH    -5
  27.  
  28. @interface Serial:Object
  29. {
  30.     int ttyPtr;
  31.     int baudrate;
  32.     int par;
  33.     id serialTarget;
  34.     SEL theSelector;
  35.     BOOL notifyStatus;
  36.     char deviceName[20];
  37.     BOOL reEnteredTtyHandler;
  38.     unsigned long timeout;
  39.     unsigned int notifyThreshold;
  40. }
  41.  
  42.  
  43. + initialize;
  44. - init;
  45. - (int) waitForInput;
  46. - (int) expectPattern:(int ) seconds: (char*) pattern ;
  47. - (int) expectStr:(int ) seconds  , ... ;
  48.  
  49. - (int)setNotify:(SEL)aSelector with:anObject;
  50. - setNotifyStatus:(BOOL)status;
  51. - (BOOL) getNotifyStatus;
  52. - setNotifyThreshold:(unsigned int) threshold;
  53. - (int) getNotifyThreshold;
  54.  
  55.  
  56. - (int) inputQueueSize;
  57. - (int) outputQueueSize;
  58.  
  59. - (int) flushOutput;
  60. - (int) flushInput;
  61. - (int) flushAll;
  62.  
  63.  
  64. - (int) openCBREAK: (const char *) portStr Baudrate:(int) baud
  65.                      Parity   :(int) parity;
  66.                      
  67. - (int) openRAW: (const char *) portStr Baudrate:(int) baud;
  68.  
  69. - (BOOL) portIsOpen;                     
  70. - (int)    closePort;
  71.  
  72. - (int) serialPrintf: (const char* ) format, ...;
  73.  
  74. - (int) writeString:(char*)str;
  75. - (int) readString: (char *) str forMaxOf:(int) max;
  76. - (int) readString: (char *) str forMaxOf:(int) max term:(char) termChar;
  77.  
  78. - (int) writeBlock:(char*) buf for:(int)  num;
  79. - (int) readBlock:(char*) buf for:(int) num;
  80. - (int) readBlock:(char*) buf for:(int) num term:(char) termChar;
  81.  
  82. - (int) setBaudRate:(int) baud;
  83. - (int) setParity:(int) parity;
  84. -  (unsigned) setCharacterTimeout:(unsigned) time;
  85.  
  86. - (int) baudrate;
  87. - (int) parity;
  88. - (unsigned) timeout;
  89. - (int) ttyptr;
  90.  
  91.  
  92. - (char*) deviceName;
  93.  
  94. - (int) dropDTR;
  95. - (int) raiseDTR;
  96.  
  97. - (int) break;
  98. - (int) dropBREAK;
  99. - (int) raiseBREAK;
  100.  
  101. - (int) useXONXOFF:(BOOL) status;
  102. - (int) modifyCRLF:(BOOL) status;
  103.  
  104. -  serialTarget;
  105. - (SEL) selector;
  106.  
  107. @end
  108.